import service from "./axios";

// 定义后端返回的数据格式
// interface ResponseData {
//   code: number;
//   message: string;
//   data?: any;
// }
// 定义后端返回的数据格式
export interface ResponseData<T = any> {
  code: number;
  message: string;
  data?: T;
}

// 封装get请求
function get(url: string, params?: any): Promise<ResponseData> {
  return service.get(url, { params });
}

// 封装post请求
function post(url: string, data?: any): Promise<ResponseData> {
  return service.post(url, data);
}

export { get, post };
